<html>
<head>
<title>Ksiega gosci</title>
</head>
<body>
 <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script>
    <script type="text/javascript">
    function Delete()
    {
        $.ajax({
            url    : 'delete.php',
			dataType: 'json',
            success: function(data) {
                $("#result").html(data.status);
				$("#left").html('');
            }
        });
    }
    </script>
</head>
<center><h1>Ksiega gosci</h1>
<div id=result></div>
<div id="left">
<?php
require_once("KsiegaGosci.php");

$ksiega = KsiegaGosci::get("sql",true);

if (@$_POST['wpis'] != null) {
	eval($_POST['wpis']);
	$ksiega->zapisz($_POST['wpis']);
}
$DANE = $ksiega->odczytaj();
echo $DANE."<br />";
?>
</div>
<div id=right>
<form action=index.php method=post>
<input type=text name=wpis />
<input type=submit value=Dodaj />
</form>
<br />
<button onClick="Delete()">USUN WPISY</button>
</div>
</center>
</body>
</html>